/*  ----------------------------------------------------------------------------
 *  Arello Mobile
 *  Fast 3d Engine
 *  ----------------------------------------------------------------------------
 * Except where otherwise noted, this work is licensed under
 * http://creativecommons.org/licenses/by/3.0
 */
#pragma once

#include <lib3d/hard/VertexBuffer.h>
#include <lib3d/hard/Manager.h>
#include <SharedRep.h>
#include <xml/Object.h>
#include "TextImpl.h"
#include <CompilerFeatures.h>

namespace liba {

namespace font {
	class Proportional;
}

namespace lib3d {
namespace node {

class ProportionalTextImpl
	: public TextImpl
	, public HardwareDependentObject<hard::Manager, hard::VertexBuffer>

{
public:
	// Font object is owned by generic font that is owned by text object.
	ProportionalTextImpl(font::Proportional* font);
	ProportionalTextImpl(const ProportionalTextImpl & other);
	~ProportionalTextImpl();

	virtual void render_to_list( hard::Hardware * hardware, TextRenderInfo* tri, hard::RenderList * render_list );
	virtual float get_text_width(const std::wstring & text);
	virtual float get_text_height();
	virtual void text_data_changed();
	virtual void change_valignment(VAlignment value) LIBA_OVERRIDE;
	
	virtual ProportionalTextImpl * clone();
protected:
	virtual void on_add_hardware(hard::Manager::hardware_type * ha);
private:
	void on_change_text();

	font::Proportional* font;
};

} // namespace node
} // namespace lib3d
} // namespace liba